-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert codebase to ESM & add build watch
support
#377
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@0xOlias https://github.com/0xOlias/ponder/actions/runs/6428097537/job/17454747341?pr=377 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small questions. Seems like most of the diff is updating imports to use the .js
prefix. Any other areas you were unsure about / I should take a close at?
packages/core/src/build/handlers.ts
Outdated
import type { Transaction } from "@/types/transaction.js"; | ||
import { isRejected } from "@/utils/promise.js"; | ||
|
||
const require = createRequire(import.meta.url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test that hot reloading still works using createRequire with the require cache invalidation trick?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup first thing. Sadly doesn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m8 be relevant evanw/esbuild#1828
If you could search globally for "await import" and review those files that would be great. Besides that majority of it is adding .js |
watch
support
Convert to ESM & add watch support for build.
Converting to ESM required
tsconfig
settings, includingmoduleResolution
to beBundler
,.js
(in spite of this),__dirname
with ESM-safe option,createRequire
for some imports,type
tomodule
,core/src/build/handlers.ts#buildRawHandlerFunctions
,core/src/config/config.ts#buildConfig
,vitest
config needed for 2 tests (ens & art-gobblers) specifically,pg
(and updating the dep),